package towerDefense.units;

import java.awt.geom.Point2D;
import java.awt.image.BufferedImage;
import java.util.LinkedList;
import towerDefense.screens.PlayScreen;


public class ValuedSprite extends LifeSprite implements Cloneable
{
    @Override
    public Object clone () throws CloneNotSupportedException
    {
        return new ValuedSprite(this.getImage(),
                                this.getRadius(),
                                this.getConstantSpeed(),
                                this.getPath(),
                                this.getMaxHP(),
                                this.getValue());
    }

    private int myValue;


    public ValuedSprite (BufferedImage image,
                         double r,
                         double spd,
                         LinkedList<Point2D> path,
                         double maxHP,
                         int val)
    {
        super(image, r, spd, path, maxHP);
        setValue(val);
    }


    public ValuedSprite (BufferedImage image,
                         double x,
                         double y,
                         double r,
                         double spd,
                         LinkedList<Point2D> path,
                         double maxHP,
                         int val)
    {
        super(image, x, y, r, spd, path, maxHP);
        setValue(val);

    }


    public ValuedSprite (double x,
                         double y,
                         double r,
                         LinkedList<Point2D> path,
                         double maxHP,
                         int val)
    {
        super(x, y, r, path, maxHP);
        setValue(val);

    }


    public void setValue (int myValue)
    {
        this.myValue = myValue;
    }


    public int getValue ()
    {
        return myValue;
    }


    @Override
    public void update (long elapsedTime)
    {
        super.update(elapsedTime);

    }


    @Override
    public void die ()
    {
        super.die();
        PlayScreen.RESOURCE_TALLY += this.getValue();
    }


    @Override
    protected void doOffScreenAction ()
    {
        super.doOffScreenAction();
        if (PlayScreen.LIFE_COUNT > 0)
        ;

        PlayScreen.LIFE_COUNT -= 1;
    }

}
